<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>我的用户列表</title>

</head>
<body>
<jsp:include page="/incloud/header.jsp" />

<div class="d-flex align-items-stretch">
    <!-- Sidebar Navigation-->
    <jsp:include page="/incloud/sidebar.jsp" />
    <!-- Sidebar Navigation end-->
    <div class="page-content">
        <div class="page-header">
            <div class="container-fluid">
                <h2 class="h5 no-margin-bottom">我的关注列表</h2>
            </div>
        </div>
        <section class="no-padding-bottom">

            <div class="list-group myList">
                <ul>
                    <c:forEach items="${userList}" var="user">
                    <li class="list-group-item">
                        <a href="/user/detail?id=${user.id}">${user.realName}</a>
                        <div style="float: right" class="text-right">
                            <input type="submit" onclick="fcous(${user.id })" class="btn btn-danger" value="取消关注">
                        </div>
                    </li>
                    </c:forEach>

                </ul>
                <nav class="text-center" aria-label="Page navigation">
                    <ul class="pagination">
                        <c:if test="${userPageUtils.pageCount > 0}">
                        <li>
                            <a href="javascript:0;" onclick="pre(${userPageUtils.cureePage})" aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                        <c:forEach begin="1" end="${userPageUtils.pageCount}" varStatus="status">
                        <li><a href="/user/findUserfocus?cureePage=${status.count}">${status.count}</a></li>
                        </c:forEach>
                        <li>
                            <a href="javascript:0;" onclick="next(${userPageUtils.cureePage})" aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                        </c:if>
                    </ul>
                </nav>
            </div>
        </section>

        <jsp:include page="/incloud/footer.jsp" />
    </div>
</div>


</body>
<script>
    //上一页
    function pre(cureePage){
        if(cureePage - 1 < 1){
            layer.msg("已经是第一页了")
            return;
        }
        location.href = "/user/findUserfocus?cureePage="+(cureePage-1);
    }
    //下一页
    function next(cureePage){
       if(cureePage +1 > ${userPageUtils.pageCount}){
            layer.msg("已经是最后一页了")
            return;
        }
        location.href = "/user/findUserfocus?cureePage="+(cureePage+1);
    }
    //取消关注
    function fcous(id) {
        location.href="/user/Attention?id="+id+"&isRemove=true";
    }
    $("#avatar").click(function () {
        location.href = "/user/detail?id=${loginUser.id}";
    })
</script>
</html>